package com.star.mentor.enums;

import com.star.common.base.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 评估规则项目类型
 *
 * @author yangzj
 */
@AllArgsConstructor
@Getter
public enum EvaluationItemType implements BaseEnum<Integer> {
    /**
     * （0基本项目 1附加项目）字典：evaluation_item_type
     */
    BASE_ITEM(0, "基本项目"),
    SUB_ITEM(1, "附加项目"),
    ;

    private final Integer code;
    private final String name;

    public static String getName(Integer code) {
        return Arrays.stream(EvaluationItemType.values())
                .filter(c -> c.getCode().equals(code)).findFirst()
                .map(EvaluationItemType::getName).orElse(null);
    }

    @Override
    public String getTypeCode() {
        return "evaluation_item_type";
    }

    @Override
    public String getTypeName() {
        return "评估规则项目类型";
    }
}
